/*
 * Lab05B.cpp
 *   More recursion: this time with arrays!!!
 *
 *  Created on: Feb 27, 2014
 *      Author: Anthony Varghese
 */

/**
 * Recursive add function
 * computes the sum a[0..n-1] using recursion
 * precondition 0 < n < N, the actual size of the array
 * postcondition: None
 */
int add(const int a[], int n){

	return a[n-1];
}

/**
 * Recursive max function
 * computes the max of a[0..n-1]
 * precondition: 0 < n < N, the actual size of the array
 * postcondition: None
 */
int max(const int a[], int n){

	return a[n-1];
}

#include <iostream>

int main(){
	const int A[] = {6, 2, 18, -4, 5, 7, 1};
	const int N = 7;

	std::cout << "Sum of " << N << " array elements is: " << add( A, N ) << std::endl << std::endl;
	std::cout << "Max of " << N << " array elements is: " << max( A, N ) << std::endl << std::endl;
}
